package com.sen.common.common.bo;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
   * @Description 认证中心-用户
   * @author esjiang
**/
@Data
public class User implements UserDetails, Serializable {

    private static final long serialVersionUID = -3685249101751401211L;

    private SysAccountBO sysAccount;

    private List<SimpleGrantedAuthority> simpleGrantedAuthorities;

    /** 人员信息 */
    private PeopleInfo peopleInfo ;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return simpleGrantedAuthorities;
    }

    @Override
    public String getPassword() {
        return sysAccount.getPassword();
    }

    @Override
    public String getUsername() {
        return sysAccount.getUserName();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

}
